import Vue from 'vue'
import VueRouter from 'vue-router'
// import Home from '../views/Home.vue'
import Footer from '@/components/Footer.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'home',
    components: {
      default: () => import('@/views/home/index.vue'),
      footer: Footer
    }
  },
  {
    path: '/kind',
    name: 'kind',
    components: {
      default: () => import('@/views/kind/index.vue'),
      footer: Footer
    }
  },
  {
    path: '/cart',
    name: 'cart',
    components: {
      default: () => import('@/views/cart/index.vue'),
      footer: Footer
    }
  },
  {
    path: '/user',
    name: 'user',
    components: {
      default: () => import('@/views/user/index.vue'),
      footer: Footer
    }
  },
  {
    path: '/utils',
    name: 'utils',
    components: {
      default: () => import('@/views/utils/index.vue')
    }
  },
  {
    path: '/search',
    name: 'search',
    components: {
      default: () => import('@/views/search/index.vue')
    }
  },
  {
    path: '/register-login',
    name: 'register-login',
    components: {
      default: () => import('@/views/register-login/index.vue')
    }
  },
  {
    path: '/login',
    name: 'login',
    components: {
      default: () => import('@/views/login/index.vue')
    }
  },
  {
    path: '/order',
    name: 'order',
    components: {
      default: () => import('@/views/order/index.vue')
    }
  },
  {
    path: '/details',
    name: 'details',
    components: {
      default: () => import('@/views/details/index.vue')
    }
  },
  {
    path: '/address',
    name: 'address',
    components: {
      default: () => import('@/views/add/index.vue')
    }
  },
  {
    path: '/addAdd',
    name: 'addAdd',
    components: {
      default: () => import('@/views/add/add.vue')
    }
  },
  {
    path: '/account',
    name: 'account',
    components: {
      default: () => import('@/views/account/index.vue')
    }
  },
  {
    path: '/success',
    name: 'success',
    components: {
      default: () => import('@/views/success/index.vue')
    }
  },
  {
    path: '/password',
    name: 'password',
    components: {
      default: () => import('@/views/account/password.vue')
    }
  }
]

const router = new VueRouter({
  // mode: 'history',
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
